import request from "@/api/index";
interface dataSourceType {
  [propName: string]: any;
}
export const checkCreatSiteForm = async (_rule: dataSourceType = {}, value: any) => {
  if (!value && value != '0' && _rule.required) {// 必填项验证非空并排除非必须项
    return;
  }
  if (_rule.type === 'phone') { // 没填值没有校验的必要
    const reg_tel = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
    if (!reg_tel.test(value)) {
      return Promise.reject(`${_rule.msg}`);
    } else {
      return Promise.resolve();
    }
  }

};
